package com.alex.jbpm.apply.action;

import org.hibernate.Session;
import org.hibernate.Transaction;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;

import com.alex.jbpm.HibernateUtils;
import com.alex.jbpm.domain.Document;


public class DepartmentApproveAction  implements ActionHandler{

	private static final long serialVersionUID = 5028695487101239749L;

	public void execute(ExecutionContext context) throws Exception {
		String documentId = context.getContextInstance().getVariable("documentId").toString();
		Session session = HibernateUtils.getSession();
		Transaction tran = session.beginTransaction();
		Document doc = (Document)session.load(Document.class, Integer.valueOf(documentId));
		doc.setExamineState("【中央】审批通过");
		tran.commit();
		System.out.println("公文：".concat(documentId).concat(" 【中央】审批通过!"));
	}

}
